---[[
--Reward system, funciona perfecto :D
--Tomados éstos valores del evaluation del SMprex3cvs
local Player = GAMESTATE:GetMasterPlayerNumber()
local CurStats = STATSMAN:GetCurStageStats():GetPlayerStageStats(Player)
local HitHoldTicks = CurStats:GetTapNoteScores('TapNoteScore_CheckpointHit')
local TnsW1s = CurStats:GetTapNoteScores('TapNoteScore_W1')
local TnsW2s = CurStats:GetTapNoteScores('TapNoteScore_W2')
local MissHoldTicks = CurStats:GetTapNoteScores('TapNoteScore_CheckpointMiss')
local TnsMiss = CurStats:GetTapNoteScores('TapNoteScore_Miss')
local Grade = CurStats:GetGrade()

--La rola que acabas de jugar
local PlayedSong = GAMESTATE:GetCurrentSong():GetDisplayFullTitle()

--Los steps que acabas de jugar
local CurSteps = GAMESTATE:GetCurrentSteps(Player)
--Necesario tener Diffstring2 en tu tema
local PlayedChart = Diffstring2(CurSteps:GetDifficulty(),CurSteps:GetStepsType(),"")
PlayedChart = PlayedChart[1]

--Condicionales...
local Perfect = HitHoldTicks + TnsW1s + TnsW2s
local Great = CurStats:GetTapNoteScores('TapNoteScore_W3')
local Good = CurStats:GetTapNoteScores('TapNoteScore_W4')
local Bad = CurStats:GetTapNoteScores('TapNoteScore_W5')
local Miss = MissHoldTicks + TnsMiss

local MaxCombo = CurStats:MaxCombo()
local Score = CurStats:GetScore()
local Life = CurStats:GetCurrentLife()
local Mines = CurStats:GetTapNoteScores('TapNoteScore_HitMine')

local S = Grade == 'Grade_Tier01' or Grade == 'Grade_Tier02'
local A = Grade == 'Grade_Tier03'
local B = Grade == 'Grade_Tier04'
local C = Grade == 'Grade_Tier05'
local D = Grade == 'Grade_Tier06'
local F	= Grade == 'Grade_Tier07' or Grade == 'Grade_Failed'

local FullCombo = function() return CurStats:FullCombo() end

--[[
#######################################################
Desde aquí se controlan los unlocks...
#######################################################
Variables posibles para las condicionales:

	-:{ numéricos: }:-
	-/ Tap Scores o judges /
	Perfect	Great	Good
	Bad	Miss
	
	-/ Misceláneos :P /-
	MaxCombo	Score
	Life	Mines

	-:{ Booleanos }:-
	-/ Grades /-
	S	A	B
	C	D	F
	
	-/ Combo /-
	FullCombo
]]

local Unlocks = {
	--Rola que se tiene que jugar (title + subtitle)
	--Se escribe como tal entre las comillas entre los brackets
	["Caprice of Otada"] = {
		--Chart que has jugado (ez, nor, hd, cz, fs, nm...)
		--EN MAYÚSCULAS (Diffstring2)
		CRAZY = {
			--Requerimentos
			Cond = Mines == 100,
			--Recompensa :P
			Reward = "DjOtada"
		};
	};
	--NO MODIFICAR ÉSTA ENTRADA
	["DEFAULT"] = { Cond = false };
}

--[[ Fin Del Control de Unlocks
#######################################################
]]

--Checa la rola primero, si no es haz default
local SongMission = Unlocks[ PlayedSong ]
if not SongMission then
	SongMission = Unlocks["DEFAULT"]
end

--Ahora los steps, y si igual entonces default...
local StepMission = SongMission[ PlayedChart ]
if not StepMission then
	StepMission = Unlocks["DEFAULT"]
end

--Aver si pasaste xD
local bPassed = StepMission.Cond
if bPassed then
	local ToUnlock = StepMission.Reward
	--SCREENMAN:SystemMessage("Unlocked entry: "..ToUnlock)
	--Unlock it!
	UNLOCKMAN:UnlockEntryID( ToUnlock )
	UNLOCKMAN:PreferUnlockEntryID( ToUnlock )
end

--Se necesita regresar algún tipo de actor...]]
return Def.Actor {}